首页

2024-06-11

vscode 使用 tsx 直接调试运行当前文件

Add the following configuration to the configurations​ array in .vscode/launch.json​:
json5
json
{ "name": "tsx", "type": "node", "request": "launch", // Debug current file in VSCode "program": "${file}", /* Path to tsx binary Assuming locally installed */ "runtimeExecutable": "tsx", /* Open terminal when debugging starts (Optional) Useful to see console.logs */ "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", // Files to exclude from debugger (e.g. call stack) "skipFiles": [ // Node.js internal core modules "/**", // Ignore all dependencies (optional) "${workspaceFolder}/node_modules/**", ], }
In VSCode, open the file you want to run